package com.joysuch.wwyt.core.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.joysuch.wwyt.core.entity.BaseUserFaceApiLog;
import com.joysuch.wwyt.core.mapper.BaseUserFaceApiLogMapper;
import com.joysuch.wwyt.core.service.BaseUserFaceApiLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * @author xsx
 * @version 1.0
 * @date 2023/3/16 9:28
 */
@Service
@Slf4j
@Transactional
public class BaseUserFaceApiLogServiceImpl  extends ServiceImpl<BaseUserFaceApiLogMapper, BaseUserFaceApiLog> implements BaseUserFaceApiLogService {
    @Override
    public void saveLog(Long userId, String method, String apiUrl, String requestBody, String response) {
        BaseUserFaceApiLog log = new BaseUserFaceApiLog();
        log.setApiUrl(apiUrl);
        log.setMethod(method);
        log.setRequestBody(requestBody);
        log.setResponse(response);
        log.setUserId(userId);
        baseMapper.insert(log);
    }
}
